Skip to content

Conversation

ioanatia
Copy link
Contributor

I wanted to use the LOCATE function for a test and noticed that we don't document the return value in case the substring is missing.

@ioanatia ioanatia added >docs General docs changes Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) auto-backport-and-merge :Analytics/ES|QL AKA ESQL v8.14.0 v8.15.0 labels Aug 26, 2024
Copy link
Contributor

Documentation preview:

@elasticsearchmachine elasticsearchmachine added Team:Docs Meta label for docs team v8.16.0 labels Aug 26, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-docs (Team:Docs)

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

Copy link
Member

@costin costin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please point out that the return position starts from 1 (not 0 as most programmers assume).

Copy link
Member

@costin costin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please point out that the return position starts from 1 (not 0 as most programmers assume).

Copy link
Member

@costin costin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The text can be slightly rephrased to be more compact.

examples = @Example(file = "string", tag = "locate")
)
@FunctionInfo(returnType = "integer", description = """
Returns an integer that indicates the position of a keyword substring within another string.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returns an integer (starting from 1) that indicates the position of a keyword substring within another string.
Returns 0 if the substring is not found.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many developers are not used with string positions starting from 1. This is why I kind of like to have that as a separate note. If you feel very strongly about I can change this again, but for now I will merge the PR as it is.

@ioanatia ioanatia merged commit 90f1fb6 into elastic:main Sep 3, 2024
15 checks passed
@ioanatia ioanatia deleted the locate_docs branch September 3, 2024 10:46
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.14 Commit could not be cherrypicked due to conflicts
8.15 Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 112202

cbuescher pushed a commit to cbuescher/elasticsearch that referenced this pull request Sep 4, 2024
…nd (elastic#112202)

* Document return value for locate in case substring is not found

* Add note that string positions start from 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL backport pending >docs General docs changes Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) Team:Docs Meta label for docs team v8.14.0 v8.15.0 v8.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants